#ifndef BAIDUAI_H
#define BAIDUAI_H

#include <QString>
#include <QMap>
#include <QJsonObject>
#include <QJsonDocument>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QEventLoop>
#include <QFile>
#include <QJsonArray>

const QString baiduTokenUrl = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=%1&client_secret=%2&";

const QString client_id = "YfZMe1mqpN2SMcfjFdWnW9JN";
const QString secret_id = "hTw49Wrl29MuTfrMmaJTBabiJfnG2ggW";

class BaiduAi
{
public:
    BaiduAi();
    //获取access_token
    static QString getAccessToken();
    //发送函数
    static bool post_sync(QString url, QMap<QString, QString>header, QByteArray requestData, QByteArray&replyData);
    //封装一个将图片转为base64格式的函数
    static QByteArray ImageToBase64(QString imgPath);
};

#endif // BAIDUAI_H
